package com.wanmait.demo.util;


import java.util.List;

public class Layui<T> {
    private Integer code=0;
    private String msg="0";
    private T data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    //本次携带的数据量
    private Integer count=0;

    private Integer total=0;
    private Layui(){};
    public static <T> Layui successsWithData(Integer code,T t){
        Layui resultData = new Layui();
        resultData.setData(t);
        resultData.setCode(code);
        if (t instanceof List){
            resultData.setCount(((List) t).size());
        }
        return resultData;
    }
}
